/*   Copyright 2012 Fernando Moreno Ruiz All Rights Reserved.
 *
 * 	 This file is part of pyPhotosMixer.
 *
 *   pyPhotosMixer is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   pyPhotosMixer is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with pyPhotosMixer.  If not, see <http://www.gnu.org/licenses/>.
 * */
import QtQuick 1.1
import "visualizer"
import "models"
import "browser"
import "commons"

Rectangle{
    id:main
    width: 800; height: 600
    color:"grey"
    property string colorCamera1:"blue"
    property string colorCamera2:"red"
    ModelsManager{
        id:models
    }
    function entra(id){
        console.log("ENTRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:" + id)
    }
    Browser{
        id:browserCamera1
        width: parent.width
        height: 100
        dir: pathCamera1
//        dir:""
        color:colorCamera1
        property bool accepted: false
        onDirAccepted: {
            models.folderCamera1  = "file:/"+browserCamera1.dir.replace("\\","/")
            accepted = true
            browserCamera1.opacity = 0
        }
    }
    Browser{
        id:browserCamera2
        color:colorCamera2
        height: 100
        dir:pathCamera2
//        dir:""
        width: parent.width
        anchors.bottom: parent.bottom
        property bool accepted: false
        onDirAccepted: {
            models.folderCamera2 = "file:/"+browserCamera2.dir.replace("\\","/")
            accepted = true
            browserCamera2.opacity = 0
        }

    }
    Visualizer{
        id:visualizer
        anchors.fill:parent
        opacity: (browserCamera1.accepted && browserCamera2.accepted)?1:0
        Button{
            id:buttonBack
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.topMargin: 3
            anchors.leftMargin: 3
            width: 200
            height: 30

            color:"#00000000"
            gradient:Gradient{
                GradientStop{color:"white";position:0}
                GradientStop{color:"black";position:1}
            }
            gradientNormal: Gradient{
                GradientStop{color:"white";position:0}
                GradientStop{color:"black";position:1}
            }
            gradientPressed: Gradient{
                GradientStop{color:"black";position:0}
                GradientStop{color:"white";position:1}
            }
            Text{
                anchors.centerIn: parent
                text:"Atrás"
            }
            onButtonClicked: {
                browserCamera1.accepted = false
                browserCamera2.accepted = false
                browserCamera1.opacity = 1
                browserCamera2.opacity = 1
            }
        }
    }
    Timer{
        id:timerAnchorBrowser
        interval: 3200
        onTriggered: {
//            browserCamera1.anchors.top=main.top
//            browserCamera2.anchors.bottom=main.bottom
        }
    }
    Component.onCompleted:{
        exif.resetThumbnailDir();
    }

}
